package factory;

interface Moveable{
    void go();
}

class Car implements Moveable{

    @Override
    public void go() {
        System.out.println("car");
    }
}

class Broom implements Moveable{

    @Override
    public void go() {
        System.out.println("broom");
    }
}


/**
 * 定义交通工具工厂
 * 简单工厂返回具体的实例子。
 */
class VehicleFactory{
    public Moveable CreateCar(){
        // 在这里做处理 权限日志啥的
        return  new Car();
    }
    public Moveable CreateBroom(){
        return new Broom();
    }
}

public class SimpleFactory {
    public static void main(String[] args) {
        System.out.println("simple factory");

        /**
         * 如何对创建Car Broom 添加权限控制。
         */
        VehicleFactory vehicleFactor = new VehicleFactory();
        vehicleFactor.CreateBroom().go();
        vehicleFactor.CreateCar().go();
    }
}
